# =============================================================================
# Find packages: boost
if(OS_WINDOWS)
  set(Boost_ROOT ${COMMON_THIRD_LIB}/boost)
  find_package(Boost 1.82 REQUIRED)
endif()

if(OS_LINUX)
  #set(Boost_USE_STATIC_LIBS ON)
  find_package(Boost 1.82 REQUIRED COMPONENTS 
    unit_test_framework 
    json 
    log
    log_setup 
    program_options 
    system 
    iostreams 
    serialization)
endif()

macro(use_boost ag_project_name)
  target_compile_definitions(${ag_project_name} PRIVATE USE_LIB_BOOST)
  target_compile_definitions(${ag_project_name} PRIVATE ${ARGN})
  target_include_directories(${ag_project_name} PRIVATE ${Boost_INCLUDE_DIRS})
  
  if(OS_WINDOWS)
    target_link_directories(${ag_project_name} PRIVATE ${Boost_ROOT}/lib)
  elseif(OS_LINUX)
    #target_compile_definitions(${ag_project_name} PRIVATE BOOST_ALL_DYN_LINK)
    target_link_libraries(${ag_project_name} PRIVATE ${Boost_LIBRARIES} bz2 z)
  endif()
endmacro(use_boost)